import { useState } from "react";

// 0. 是一个组件
export function RenderMouse({ render }) {
  // 1. 组件内封装数据和逻辑
  const [mouse, setMouse] = useState({ x: 0, y: 0 });
  const handleMouseMove = (e) => {
    setMouse({ x: e.clientX, y: e.clientY });
  };

  // 3. props.render的参数, 是封装的逻辑
  const res = render({ mouse, handleMouseMove }); // ?
  return res;
}
